
import javax.swing.*;
import cadastros.*;
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * TelaPrincipal.java
 *
 * Created on 02/09/2011, 00:06:01
 */

/**
 *
 * @author Thiago
 */
public class TelaPrincipal extends javax.swing.JFrame {
      data mostra_data;
      String seta_look= "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
    /** Creates new form TelaPrincipal */
    public TelaPrincipal() {
        initComponents();
        mostra_data = new data();
        mostra_data.le_data();
        label_data.setText(mostra_data.dia_semana+", " + mostra_data.dia+" de " + mostra_data.mes + " de "+mostra_data.ano);
        timer1.start();

        lookandfeel();

        

    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        timer1 = new org.netbeans.examples.lib.timerbean.Timer();
        jPanel1 = new javax.swing.JPanel();
        label_data = new java.awt.Label();
        label_hora = new java.awt.Label();
        jLabel1 = new javax.swing.JLabel();
        button1 = new java.awt.Button();
        jMenuBar1 = new javax.swing.JMenuBar();
        menu_cadastros = new javax.swing.JMenu();
        menucadastro_departamento = new javax.swing.JMenuItem();
        menucadastro_blocos = new javax.swing.JMenuItem();
        menucadastro_salas = new javax.swing.JMenuItem();
        jSeparator1 = new javax.swing.JPopupMenu.Separator();
        menucadastro_usuarios = new javax.swing.JMenuItem();
        jSeparator2 = new javax.swing.JPopupMenu.Separator();
        menucadastro_atividades = new javax.swing.JMenuItem();
        menu_busca = new javax.swing.JMenu();
        menu_alocar = new javax.swing.JMenu();
        menu_relatorios = new javax.swing.JMenu();
        menurelatorio_departamento = new javax.swing.JMenuItem();
        menurelatorio_bloco = new javax.swing.JMenuItem();
        menurelatorio_salas = new javax.swing.JMenuItem();
        menu_skin = new javax.swing.JMenu();
        jMenuItem1 = new javax.swing.JMenuItem();
        jMenuItem2 = new javax.swing.JMenuItem();
        jMenuItem3 = new javax.swing.JMenuItem();
        jMenuItem4 = new javax.swing.JMenuItem();
        menu_ajuda = new javax.swing.JMenu();
        menu_sair = new javax.swing.JMenu();

        timer1.addTimerListener(new org.netbeans.examples.lib.timerbean.TimerListener() {
            public void onTime(java.awt.event.ActionEvent evt) {
                timer1OnTime(evt);
            }
        });

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Sistema Inteligente de Monitoramento de Salas");

        jPanel1.setBackground(new java.awt.Color(0, 102, 255));
        jPanel1.setForeground(new java.awt.Color(51, 51, 255));

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 804, Short.MAX_VALUE)
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 100, Short.MAX_VALUE)
        );

        label_data.setText("Data.:");

        label_hora.setText("Hora.:");

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/header.jpg"))); // NOI18N

        button1.setLabel("Atividades");

        menu_cadastros.setMnemonic('C');
        menu_cadastros.setText("Cadastros");

        menucadastro_departamento.setMnemonic('D');
        menucadastro_departamento.setText("Departamento");
        menucadastro_departamento.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menucadastro_departamentoActionPerformed(evt);
            }
        });
        menu_cadastros.add(menucadastro_departamento);

        menucadastro_blocos.setMnemonic('B');
        menucadastro_blocos.setText("Blocos");
        menucadastro_blocos.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menucadastro_blocosActionPerformed(evt);
            }
        });
        menu_cadastros.add(menucadastro_blocos);

        menucadastro_salas.setMnemonic('S');
        menucadastro_salas.setText("Salas");
        menucadastro_salas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menucadastro_salasActionPerformed(evt);
            }
        });
        menu_cadastros.add(menucadastro_salas);
        menu_cadastros.add(jSeparator1);

        menucadastro_usuarios.setMnemonic('U');
        menucadastro_usuarios.setText("Usuarios");
        menu_cadastros.add(menucadastro_usuarios);
        menu_cadastros.add(jSeparator2);

        menucadastro_atividades.setMnemonic('A');
        menucadastro_atividades.setText("Atividades");
        menucadastro_atividades.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menucadastro_atividadesActionPerformed(evt);
            }
        });
        menu_cadastros.add(menucadastro_atividades);

        jMenuBar1.add(menu_cadastros);

        menu_busca.setMnemonic('B');
        menu_busca.setText("Busca");
        jMenuBar1.add(menu_busca);
        jMenuBar1.add(menu_alocar);

        menu_relatorios.setMnemonic('R');
        menu_relatorios.setText("Relatórios");

        menurelatorio_departamento.setMnemonic('D');
        menurelatorio_departamento.setText("Departamento ");
        menu_relatorios.add(menurelatorio_departamento);

        menurelatorio_bloco.setMnemonic('B');
        menurelatorio_bloco.setText("Bloco");
        menu_relatorios.add(menurelatorio_bloco);

        menurelatorio_salas.setMnemonic('S');
        menurelatorio_salas.setText("Salas");
        menu_relatorios.add(menurelatorio_salas);

        jMenuBar1.add(menu_relatorios);

        menu_skin.setMnemonic('S');
        menu_skin.setText("Skin");

        jMenuItem1.setMnemonic('W');
        jMenuItem1.setText("Windows");
        jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        menu_skin.add(jMenuItem1);

        jMenuItem2.setMnemonic('L');
        jMenuItem2.setText("Liquid");
        jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem2ActionPerformed(evt);
            }
        });
        menu_skin.add(jMenuItem2);

        jMenuItem3.setMnemonic('M');
        jMenuItem3.setText("Metal");
        jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem3ActionPerformed(evt);
            }
        });
        menu_skin.add(jMenuItem3);

        jMenuItem4.setMnemonic('C');
        jMenuItem4.setText("CDE/MOTIF");
        jMenuItem4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem4ActionPerformed(evt);
            }
        });
        menu_skin.add(jMenuItem4);

        jMenuBar1.add(menu_skin);

        menu_ajuda.setMnemonic('A');
        menu_ajuda.setText("Ajuda");
        jMenuBar1.add(menu_ajuda);

        menu_sair.setMnemonic('S');
        menu_sair.setText("Sair");
        menu_sair.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                menu_sairMouseClicked(evt);
            }
        });
        menu_sair.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menu_sairActionPerformed(evt);
            }
        });
        jMenuBar1.add(menu_sair);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(label_data, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 514, Short.MAX_VALUE)
                .addComponent(label_hora, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(207, 207, 207))
            .addGroup(layout.createSequentialGroup()
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 794, Short.MAX_VALUE)
                .addContainerGap())
            .addGroup(layout.createSequentialGroup()
                .addGap(203, 203, 203)
                .addComponent(button1, javax.swing.GroupLayout.PREFERRED_SIZE, 330, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(271, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(button1, javax.swing.GroupLayout.DEFAULT_SIZE, 55, Short.MAX_VALUE)
                        .addGap(100, 100, 100)
                        .addComponent(label_data, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(label_hora, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
        );

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-800)/2, (screenSize.height-600)/2, 800, 600);
    }// </editor-fold>//GEN-END:initComponents

    private void timer1OnTime(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_timer1OnTime
       mostra_data.le_hora();
        label_hora.setText("Hora atual "+mostra_data.hora);

    }//GEN-LAST:event_timer1OnTime

    private void menu_sairActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menu_sairActionPerformed
        // TODOdd your handling code here:
    }//GEN-LAST:event_menu_sairActionPerformed

    private void menu_sairMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_menu_sairMouseClicked
       System.exit(0);
    }//GEN-LAST:event_menu_sairMouseClicked

    private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
       seta_look="com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
       lookandfeel();
    }//GEN-LAST:event_jMenuItem1ActionPerformed

    private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed
       seta_look="com.birosoft.liquid.LiquidLookAndFeel";
       lookandfeel();

    }//GEN-LAST:event_jMenuItem2ActionPerformed

    private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem3ActionPerformed
       seta_look="javax.swing.plaf.metal.MetalLookAndFeel";
       lookandfeel();
    }//GEN-LAST:event_jMenuItem3ActionPerformed

    private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem4ActionPerformed
       seta_look="com.sun.java.swing.plaf.motif.MotifLookAndFeel";
       lookandfeel();
    }//GEN-LAST:event_jMenuItem4ActionPerformed

    private void menucadastro_blocosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menucadastro_blocosActionPerformed
       new blocos().show(); // TODO add your handling code here:
    }//GEN-LAST:event_menucadastro_blocosActionPerformed

    private void menucadastro_departamentoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menucadastro_departamentoActionPerformed
        new departamento().show();        // TODO add your handling code here:
    }//GEN-LAST:event_menucadastro_departamentoActionPerformed

    private void menucadastro_atividadesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menucadastro_atividadesActionPerformed
        new atividades().show();// TODO add your handling code here:
    }//GEN-LAST:event_menucadastro_atividadesActionPerformed

    private void menucadastro_salasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menucadastro_salasActionPerformed
        new salas().show();        // TODO add your handling code here:
    }//GEN-LAST:event_menucadastro_salasActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new TelaPrincipal().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private java.awt.Button button1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JMenuItem jMenuItem3;
    private javax.swing.JMenuItem jMenuItem4;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPopupMenu.Separator jSeparator1;
    private javax.swing.JPopupMenu.Separator jSeparator2;
    private java.awt.Label label_data;
    private java.awt.Label label_hora;
    private javax.swing.JMenu menu_ajuda;
    private javax.swing.JMenu menu_alocar;
    private javax.swing.JMenu menu_busca;
    private javax.swing.JMenu menu_cadastros;
    private javax.swing.JMenu menu_relatorios;
    private javax.swing.JMenu menu_sair;
    private javax.swing.JMenu menu_skin;
    private javax.swing.JMenuItem menucadastro_atividades;
    private javax.swing.JMenuItem menucadastro_blocos;
    private javax.swing.JMenuItem menucadastro_departamento;
    private javax.swing.JMenuItem menucadastro_salas;
    private javax.swing.JMenuItem menucadastro_usuarios;
    private javax.swing.JMenuItem menurelatorio_bloco;
    private javax.swing.JMenuItem menurelatorio_departamento;
    private javax.swing.JMenuItem menurelatorio_salas;
    private org.netbeans.examples.lib.timerbean.Timer timer1;
    // End of variables declaration//GEN-END:variables


    public void lookandfeel()
    {
        try
        {
            UIManager.setLookAndFeel(seta_look);
            SwingUtilities.updateComponentTreeUI(this);
        }
        catch(Exception erro)
        {
            JOptionPane.showMessageDialog(null, erro);
        }
    }
}
